abstract class Express{
    int weight;
    public Express(int weight) {
        this.weight = weight;
    }
    public int getWeight(){
        return weight;
    }
    abstract int getTotal();
}
class SLExpress extends Express{
    public SLExpress(int weight) {
        super(weight);
    }
    int getTotal() {
        if (weight == 1){
            return 12;
        }else {
            return 12 + (weight - 1)*14;
        }
    }
}
class DDExpress extends Express{
        public DDExpress(int weight) {
            super(weight);
        }

        int getTotal() {
            if (weight == 1){
                return 5;
            }else {
                return 5 + (weight - 1)*6;
            }
        }
    }
    class CaicaiStation{
        int calculate(Express[] ex){
            int sum = 0;
            for (Express x : ex){
                sum += x.getTotal();
            }
            return sum;
        }
    }